package cae.logic.destination;

import java.io.Serializable;

public class CaeDestination implements Serializable
{
	private static final long serialVersionUID = 1L;
	private String alias;
	private String[] machine;
	private int port;
	private int filePort;
	private int chatPort;
	private transient boolean connected = true; 
	
	public CaeDestination()
	{}
	
	public CaeDestination(String alias, String machine, int port, int filePort, int chatPort) {
		super();
		this.alias = alias;
		this.machine = machine.split(",");
		this.port = port;
		this.filePort = filePort;
		this.chatPort = chatPort;
	}
	
	public String getAlias() {
		return alias;
	}
	public void setAlias(String alias) {
		this.alias = alias;
	}
	public String[] getMachine() {
		return machine;
	}
	public void setMachine(String[] machine) {
		this.machine = machine;
	}
	public int getPort() {
		return port;
	}
	public void setPort(int port) {
		this.port = port;
	}
	public int getChatPort() {
		return chatPort;
	}
	public void setChatPort(int chatPort) {
		this.chatPort = chatPort;
	}
	public int getFilePort() {
		return filePort;
	}
	public void setFilePort(int filePort) {
		this.filePort = filePort;
	}
	public boolean isConnected() {
		return connected;
	}
	public void setConnected(boolean connected) {
		this.connected = connected;
	}

	@Override
	public boolean equals(Object obj)
	{
		if(this == obj)
			return true;
		if((obj == null) || (obj.getClass() != this.getClass()))
			return false;
			
		CaeDestination dest = (CaeDestination)obj;
			return this.getAlias().equalsIgnoreCase(dest.getAlias());
	}

	@Override
	public int hashCode() {
		return this.getMachine().hashCode();
	}
}
